<?php
namespace app\mini\model;

use think\facade\Db;
use app\common\traits\ActionRecordTrait;
use think\Model;
use app\admin\controller\ApiCommon;


class AddModel extends Model
{
    /**

     * @var string

     */

    protected $name = 'admin_sys';


    protected $defaultSoftDelete = 0;


    protected $autoWriteTimestamp = true;


    /**
     *  新增意见反馈
     */
    public function addFeedback($request): array
    {
        $customer_id = $request['customer_id'];

        $shop_id = Db::name('customer')->where('id',$customer_id)->value('shop_id');

        $feed_back_value = $request['textValue'];

        $type = $request['type'];

        $data = [
            'customer_id' => $customer_id,
            'shop_id' => $shop_id,
            'type' => $type,
            'feed_back_value' => $feed_back_value,
            'create_time' => time(),
        ];

        $getId = Db::name('feedbacks')->insertGetId($data);

        if($getId){
            return [
                'msg' => '新增成功',
            ];
        }else{
            return [
                'msg' => '新增失败',
            ];
        }


    }

}
